<?php

namespace app\api\controller;

use app\common\controller\Api;
use think\Db;

/**
 * 首页接口
 */
class Index extends Api
{
    protected $noNeedLogin = ['banner'];
    protected $noNeedRight = ['*'];

    /**
     * 首页幻灯片 出售
     */
    public function banner()
    {

        $list = Db::name('banner')->order('weigh desc')->select();

        foreach ($list as $k => $v){
            $list[$k]['image'] = cdnurl($v['image'],true);
        }

        $this->success('请求成功', $list);

    }

    /**
     * 获取通知信息
     */
    public function getnotice(){

        $list = Db::name('message')->order('weigh desc')->limit(5)->select();

        $this->success('获取通知信息', $list);


    }

    public function getallnotice()
    {
        $list = Db::name('message')->order('weigh desc')->select();

        foreach ($list as $k => $v){
            $list[$k]['time'] = date('y-m-d h:i',$v['time']);
        }
        $this->success('获取通知信息', $list);
    }




}
